/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.engin.engin;

import ac.engin.archive.clients;
import ac.engin.treasury.treasuryData;
import static ac.settings.rowsStatus.rowDeleted;
import ac.ui.utils;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ismail
 */
public class treeadds extends ac.ui.FrameOperationTemplat {

    public String[] getRow(int id) {
        return db.getRow(TabelString, id);
    }

    public void removType(String Type, String id) {
        if (Type.equalsIgnoreCase("treasuryType")) {
            treasuryData t = new treasuryData();
            t.removeTreasury("" + id);

        } else if (Type.equalsIgnoreCase("inventory")) {
            ac.engin.archive.Products p = new ac.engin.archive.Products();
            p.removeInventory(id);

        }
    }

    public void removeAll() {

        if (utils.sendRemoveMssage(null) == 0) {
            try {

                db.setOpenCon();

                ResultSet r = db.getDataWithOutCon(TabelString, "*", "rowstatus ='" + rowDeleted + "'");
                while (r.next()) {

                    removType(r.getString("type"), r.getString("id"));
                }

                db.setCloseCon();
            } catch (SQLException ex) {
                Logger.getLogger(clients.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

}
